package main

import (
	"fmt"
	"net"
	"os"
)

func main() {
	//if len(os.Args) != 2 {
	//	fmt.Fprintf(os.Stderr, "Usage: %s host:port ", os.Args[0])
	//	os.Exit(1)
	//}
	//service := os.Args[1]
	//fmt.Println(service)
	//udpAddr, err := net.ResolveTCPAddr("udp4", service)
	//checkError(err)
	//conn, err := net.DialTCP("udp", nil, udpAddr)
	conn, err := net.Dial("udp", "127.0.0.1:7777")
	checkError1(err)
	_, err = conn.Write([]byte("anything"))
	checkError1(err)
	var buf [512]byte
	n, err := conn.Read(buf[0:])
	checkError1(err)
	fmt.Println(string(buf[0:n]))
	os.Exit(1)
}
func checkError1(err error) {
	if err != nil {
		fmt.Fprintf(os.Stderr, "Fatal error: %s", err.Error())
		os.Exit(1)
	}
}
